Skip to content

ND scans: rebased on main, with finalization-crash and pipe_planner fixes - #930

Open
alongd wants to merge 5 commits into
mainfrom
nd_scans_rebased
Open

ND scans: rebased on main, with finalization-crash and pipe_planner fixes#930
alongd wants to merge 5 commits into
mainfrom
nd_scans_rebased

Conversation

@alongd

@alongd alongd commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

This PR supersedes/complements #855. It is #855's four commits (Added the ND Scan module, Added directed scan to xTB job adapter, Added ND scan functionalities to plotter, Adaptations to Scheduler) rebased onto current main (263 commits of drift since #855 was opened), plus two additional fixes:

#855 should not be force-pushed or rebased in place — its branch (nd_scans) is currently checked out in a live, long-running working session with uncommitted local patches, and rewriting it there would destroy that work. This PR exists so the rebased/fixed history can be reviewed and landed without touching nd_scans.

Detailed review findings (conflict-resolution notes, two latent bugs found on main, the finalization-crash fix, and several design questions worth discussing) are posted as a comment on #855.

Closes/relates to #855.

Test plan

Comment thread arc/scheduler_test.py


import arc.parser.parser as parser
import arc.scheduler as sched_module
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.88%. Comparing base (5b5b11b) to head (9bf5748).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #930      +/-   ##
==========================================
+ Coverage   64.11%   64.88%   +0.76%     
==========================================
  Files         119      120       +1     
  Lines       39539    40376     +837     
  Branches    10261    10415     +154     
==========================================
+ Hits        25352    26198     +846     
+ Misses      11213    11123      -90     
- Partials     2974     3055      +81     
Flag Coverage Δ
functionaltests 64.88% <ø> (+0.76%) ⬆️
unittests 64.88% <ø> (+0.76%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR rebases and integrates the ND rotor-scan work (superseding #855) onto current main, adds an ESS finalization crash fix, fixes a pipe-mode initialization-order issue in Scheduler.__init__, and introduces adaptive sparse 2D scan support end-to-end (scan utilities, scheduler orchestration, plotting, and tests).

Changes:

  • Added arc/species/nd_scan.py to centralize ND scan utilities and implement adaptive sparse 2D scanning, validation, coupling metrics, and classification.
  • Updated arc/scheduler.py to use the new ND-scan utilities, fix ESS scan finalization, support adaptive batching, and fix pipe planner/coordinator initialization ordering.
  • Added sparse/adaptive 2D plotting support in arc/plotter.py, plus extensive unit/functional tests and an xTB directed-scan --opt fix.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
arc/species/nd_scan.py New ND scan utility module including adaptive sparse 2D scanning, validation, and classification helpers.
arc/species/nd_scan_test.py New unit tests covering dense/continuous/adaptive scan utilities, validation, and classification.
arc/scheduler.py Integrates ND scan module, adds adaptive scan orchestration, fixes ESS finalization crash, and adjusts pipe init ordering.
arc/scheduler_test.py Adds functional directed-scan tests (dense + adaptive) using xTB, and related helpers.
arc/plotter.py Adds sparse/adaptive 2D plotting path (interpolation + overlays) and fixes axis limit setting bugs.
arc/plotter_test.py Adds tests for sparse plotting helpers and non-crashing plot generation.
arc/job/adapters/xtb_adapter.py Ensures directed_scan jobs that are optimization scans pass --opt to xTB.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread arc/scheduler.py
Comment on lines 783 to +787
if 'brute_force' in job.directed_scan_type:
# Just terminated a brute_force directed scan job.
# Are there additional jobs of the same type currently running for this species?
self.species_dict[label].rotors_dict[job.rotor_index]['number_of_running_jobs'] -= 1
if not self.species_dict[label].rotors_dict[job.rotor_index]['number_of_running_jobs']:
# All brute force scan jobs for these pivots terminated.
logger.info(f'\nAll brute force directed scan jobs for species {label} between '
f'pivots {job.pivots} successfully terminated.\n')
self.process_directed_scans(label, pivots=job.pivots)
rotor_dict = self.species_dict[label].rotors_dict[job.rotor_index]
all_done = decrement_running_jobs(rotor_dict)
if all_done:
Comment thread arc/plotter.py
Comment on lines +1419 to +1426
xs, ys, energies = [], [], []
for key, entry in results.get('directed_scan', {}).items():
e = entry.get('energy')
if e is not None:
xs.append(float(key[0]))
ys.append(float(key[1]))
energies.append(float(e))
summary = results.get('adaptive_scan_summary', {})
alongd added 5 commits August 14, 2026 15:58
Contains pure scan-surface helpers
Scheduler.__init__ calls run_scan_jobs() from its per-species restart loop,
and run_scan_jobs dereferences self.pipe_planner via try_pipe_rotor_scans_1d().
The planner was constructed after that loop, so restarting a project with
pending 1D rotor scans raised:
    AttributeError: 'Scheduler' object has no attribute 'pipe_planner'

Construction now happens before the restart loop. Both PipeCoordinator and
PipePlanner only store references in __init__, so early construction is safe.

This is a latent bug on main (main:464/487/511 call run_scan_jobs; main:521
assigns pipe_planner); it was surfaced by the ND scan functional tests, which
are the first tests to exercise that construction path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants